<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/6/29
 * Time: 17:41
 */

namespace Admin\Model;
use Base\Model\BaseModel;
use Think\Page;

class MedicineinfoModel extends BaseModel

{
    protected $_validate = array(
        array('name', 'require', '药品名称必须填写'),
//        array('name', '', '药品已存在', 0, 'unique', 3),
//        array('name_en','/^[a-zA-Z]+$/','英文名称必须为英文！',2),
//        array('short_name_en','/^[a-zA-Z]+$/', '缩略英文名称必须为英文！',2),
      //  array('dose','/^[0-9]+$/', '越界了，药品剂量输入整数型！',2),

    );
    protected $_auto = array(
        array('status', '1'),
    );
    protected $_link = array(
        'medicinetype' => array(
            'mapping_type' => self::BELONGS_TO,
            'foreign_key' => 'typeid',
            'parent_key' => 'id',
        ),
        'doseinfo' => array(
            'mapping_type' => self::BELONGS_TO,
            'foreign_key' => 'dose',
            'parent_key' => 'id',
        ),

    );
}